//
//  HHRecommendTagCell.m
//  百思不得姐
//
//  Created by hjl on 16/4/13.
//  Copyright © 2016年 hjl. All rights reserved.
//

#import "HHRecommendTagCell.h"
#import "HHRecommendTag.h"
#import <UIImageView+WebCache.h>

@interface HHRecommendTagCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconImage;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *subLabel;

@end

@implementation HHRecommendTagCell

- (void)setFrame:(CGRect)frame{
    
    frame.origin.x = 10;
    frame.size.width -= 20;
    
    frame.origin.y += 5;
    frame.size.height -= 10;
    
    [super setFrame:frame];
}


-(void)setRecommendTag:(HHRecommendTag *)recommendTag{
    _recommendTag = recommendTag;
    
    self.nameLabel.text = recommendTag.theme_name;
    
    if (recommendTag.sub_number < 10000) {
        self.subLabel.text = [NSString stringWithFormat:@"%zd人订阅", recommendTag.sub_number];
    }else{
        CGFloat subCount = recommendTag.sub_number / 10000.0;
        self.subLabel.text = [NSString stringWithFormat:@"%.1f万人订阅", subCount];
    }
    
    [self.iconImage sd_setImageWithURL:[NSURL URLWithString:recommendTag.image_list] placeholderImage:[UIImage imageNamed:@"defaultUserIcon"]];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
